/* jshint indent: 2 */

module.exports = function(sequelize, DataTypes) {
  return sequelize.define('orderlist', {
    id: {
      type: DataTypes.INTEGER(30),
      allowNull: false,
      primaryKey: true,
      autoIncrement: true
    },
    common_user_id: {
      type: DataTypes.INTEGER(10),
      allowNull: false,
      references: {
        model: 'common_user',
        key: 'id'
      }
    },
    product_id: {
      type: DataTypes.INTEGER(30),
      allowNull: false,
      references: {
        model: 'product',
        key: 'id'
      }
    },
    remark: {
      type: DataTypes.STRING(200),
      allowNull: true
    },
    created_at: {
      type: DataTypes.DATEONLY,
      allowNull: true
    },
    updated_at: {
      type: DataTypes.DATEONLY,
      allowNull: true
    },
    status: {
      type: DataTypes.INTEGER(1),
      allowNull: false
    },
    pay_type: {
      type: DataTypes.INTEGER(10),
      allowNull: false
    },
    send_type: {
      type: DataTypes.INTEGER(10),
      allowNull: false
    },
    total: {
      type: DataTypes.INTEGER(30),
      allowNull: false
    },
    count: {
      type: DataTypes.INTEGER(30),
      allowNull: false
    },
    order_id: {
      type: DataTypes.STRING(30),
      allowNull: false
    },
    address_id: {
      type: DataTypes.INTEGER(30),
      allowNull: false,
      references: {
        model: 'address',
        key: 'id'
      }
    }
  }, {
    tableName: 'orderlist'
  });
};
